<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function ask(ques, yes, no) {
        // let yes = f1, no = f2
        // 弹窗提示信息
        if (confirm(ques)) {
          // console.log("f1");
          yes(); //用户确定后执行
        } else {
          // console.log("f2");
          no(); //用户取消后执行
        }
      }
      const f1 = function () {
        console.log("f1");
      };
      const f2 = function () {
        console.log("f2");
      };
      ask("hello jack", f1, f2);
    </script>
  </body>
</html>
